package FSMDE.controllers.tests.mocks;

import java.util.ArrayList;
import java.util.List;

import main.java.FSMDE.controllers.ITransitionController;
import main.java.FSMDE.controllers.listeners.ITransitionEventListener;
import main.java.FSMDE.models.Transition;
import main.java.FSMDE.views.ITransitionView;


public class MockTransitionController implements ITransitionController {

	private boolean createCalled;
	private List<ITransitionEventListener> listeners;
	private int updateCalls;
	
	public MockTransitionController(){
		this.createCalled = false;
		this.listeners = new ArrayList<ITransitionEventListener>();
	}
	
	public boolean createWasCalled() {
		return this.createCalled;
	}

	@Override
	public ITransitionView getTransitionView() {
		return null;
	}

	@Override
	public void addSubscriber(ITransitionEventListener listener) {
		this.listeners.add(listener);
	}

	@Override
	public boolean addTransition() {
		return false;
	}

	@Override
	public void setTransitionView(ITransitionView transitionView) {
	}

	@Override
	public void create() {
		this.createCalled = true;
	}

	@Override
	public void create(Transition transition) {
		this.updateCalls++;
	}

	public int getUpdateCallsCount() {
		return this.updateCalls;
	}

	@Override
	public boolean validTransitionName(String transitionName) {
		return false;
	}

	public List<ITransitionEventListener> getListeners() {
		return this.listeners;
	}

	@Override
	public void cancelPendingTransitionAction() {
	}

}
